package com.ysd.lis.controller;


import com.ysd.common.Result;
import com.ysd.lis.annotation.LogDetail;
import com.ysd.lis.aspect.OperationType;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.WkQualityStage;
import com.ysd.lis.request.QualityStageListParams;
import com.ysd.lis.service.WkQualityStageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 质量控制阶段表 前端控制器
 * </p>
 *
 * @author LiuQi
 * @since 2024-05-07
 */
@RestController
@RequestMapping("/wk/quality/stage")
public class WkQualityStageController extends BaseController {

    @Resource
    WkQualityStageService wkQualityStageService;

    @GetMapping("/getQualityStageList")
    public Result getQualityStageList(QualityStageListParams QualityStageListParams) {
        return wkQualityStageService.getQualityStageList(QualityStageListParams);
    }
    @PostMapping("/addQualityStage")
    @LogDetail(requestParam = "add", operationType = OperationType.INSERT, module = "质量控制-阶段类型字典", content = "新增", businessName = "qualityStage")
    public Result addQualityStage(@RequestBody WkQualityStage wkQualityStage) {
        return wkQualityStageService.addQualityStage(wkQualityStage);
    }
    @PostMapping("/editQualityStage")
    @LogDetail(requestParam = "update", operationType = OperationType.UPDATE, module = "质量控制-阶段类型字典", content = "编辑", businessName = "qualityStage")
    public Result editQualityStage(@RequestBody WkQualityStage wkQualityStage) {
        return wkQualityStageService.editQualityStage(wkQualityStage);
    }

    @PostMapping("/updateStagePathUrl")
    @LogDetail(requestParam = "update", operationType = OperationType.UPDATE, module = "质量控制-阶段类型字典", content = "维护阶段类型模板", businessName = "qualityStage")
    public Result updateStagePathUrl(@RequestBody WkQualityStage wkQualityStage) {
        return wkQualityStageService.updateStagePathUrl(wkQualityStage.getStageFileUrl(), wkQualityStage.getId(), wkQualityStage.getHistoryUrl());
    }
    @PostMapping("/deleteQualityStage")
    @LogDetail(requestParam = "delete", operationType = OperationType.DELETE, module = "质量控制-阶段类型字典", content = "删除", businessName = "qualityStage")
    public Result deleteQualityStage(@RequestBody List<String> ids) {
        return wkQualityStageService.deleteQualityStage(ids);
    }
}
